
Partial Class Admin_frmModifyCategory
    Inherits System.Web.UI.Page
    Dim VarCatName As String
    Dim _CategoryVO As New CategoryVo
    Dim _BO As New Bo
    Dim _EmployeeId As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _EmployeeId = Session("EmpId")
        If _EmployeeId = "" Then
            ' Response.Redirect("../Client/frmLogin.aspx")
        End If
        VarCatName = Request.QueryString("CategoryName")
        If VarCatName = "" Then
            ' Response.Redirect("frmTabCategory.aspx")
        Else
            If Not IsPostBack Then
                GetCategoryData()
            End If
        End If
    End Sub
    Sub GetCategoryData()
        _CategoryVO = _BO.getCategoryById(VarCatName)
        lblCategoryId.Text = _CategoryVO.CategoryId
        txtCategoryName.Text = _CategoryVO.CategoryName
    End Sub

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        SetData()
        Session("EmpId") = _EmployeeId
    End Sub
    Sub SetData()
        _CategoryVO.CategoryId = lblCategoryId.Text
        _CategoryVO.CategoryName = txtCategoryName.Text
        _BO.ModifyCategory(_CategoryVO)
        ClearAll()
    End Sub
    Public Sub ClearAll()
        txtCategoryName.Text = ""
        MsgBox("Category Modified")
        Response.Redirect("frmTabCategory.aspx", False)
    End Sub

    Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
        txtCategoryName.Text = ""
    End Sub
End Class
